//
//  LCYEmoticonPickerCollectionViewFlowLayout.m
//  IMByLinkUs
//
//  Created by lcy on 16/1/14.
//  Copyright © 2016年 lcy. All rights reserved.
//

#import "LCYEmoticonPickerCollectionViewFlowLayout.h"

@implementation LCYEmoticonPickerCollectionViewFlowLayout

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.itemSize = CGSizeMake(20, 20);
    self.sectionInset = UIEdgeInsetsMake(5, 25, 5, 25);
    self.minimumLineSpacing = 41.0;
    self.scrollDirection = UICollectionViewScrollDirectionHorizontal;
}

// 初始的layout外观将由该方法返回的UICollctionViewLayoutAttributes来决定
-(NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
{
    NSArray* array = [super layoutAttributesForElementsInRect:rect];
    CGRect visibleRect;
    visibleRect.origin = self.collectionView.contentOffset;
    visibleRect.size = self.collectionView.bounds.size;
    for (UICollectionViewLayoutAttributes *attributes in array) {
        if (CGRectIntersectsRect(attributes.frame, rect)) {
            
            attributes.size = CGSizeMake(25, 25);
            
        }
    }
    return array;
}



@end
